<template>
  <el-select v-model="proId" placeholder="请选择" @change="change">
    <el-option
      v-for="item in projects"
      :key="item.id"
      :label="item.label"
      :value="item.id">
    </el-option>
  </el-select>
</template>

<script>
    import {getProject} from '@/api/research';
    export default {
        name: "index",
        model: {
          prop: 'proId',
          event: 'cc'
        },
        props:["proId"],
        data() {
          return {
            projects: []
          }
        },
        mounted() {
          let _this = this;
          getProject().then(function (data) {
            if (data.code == 200){
              _this.projects = data.data;
            } else{
              _this.$message.error(data.message);
            }
          })
        },
        methods : {
          updateParentVal(val){
            this.$emit('cc', val)
          },
          change(val){
            this.updateParentVal(val);
          }
        }
    }
</script>

<style scoped>

</style>
